package ui.fragment

import android.content.Intent
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import com.example.mynewsapp.databinding.FragmentCategoryBinding
import ui.extra_activity.CameraActivity
import ui.extra_activity.GoogleMapActivity
import ui.extra_activity.RouteMapActivity

class CategoryFragment : Fragment() {
    private lateinit var binding: FragmentCategoryBinding

    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        binding = FragmentCategoryBinding.inflate(inflater, container, false)
        initListener(binding)


        return binding.root

    }

    private fun initListener(binding: FragmentCategoryBinding) {
        binding.openCameraBtn.setOnClickListener {
            openCameraActivityBtn()
        }

        binding.openGoogleMapBtn.setOnClickListener {
            openGoogleMapActivityBtn()
        }

        binding.openRouteMapBtn.setOnClickListener {
            openRouteMapActivityBtn()
        }
    }


    private fun openGoogleMapActivityBtn() {
        startActivity(Intent(requireActivity(), GoogleMapActivity::class.java))
    }

    private fun openRouteMapActivityBtn() {
        startActivity(Intent(requireActivity(), RouteMapActivity::class.java))
    }


    private fun openCameraActivityBtn() {
        startActivity(Intent(requireActivity(), CameraActivity::class.java))
    }

}